package luogu;

import java.util.Scanner;

public class Main6 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n  = 0; //完整的组数  第一组1天  第二组2天  第三组3天
        int countDays = 0 ;//完整组的总天数   1+2+3+4
        //找出最大的count
        while (countDays+n+1<=k){
            n++;
            countDays += n;
        }
        /**
         * 公式法  int sum1 = n*(n+1)*(2*n+1)/6
         */
        int sum1 = 0 ;
        for (int i = 1; i <=n ; i++) {
            sum1 += i * i;
        }
        //计算剩余天数的金币
        int sum2  = (k-countDays)*(n+1);
        int sum = sum1 + sum2;
        System.out.println(sum);
    }
}
